import cmd from "./Cmd.js";
import lang from "./conf/Lang.js";
import config from "./conf/Config.js";

var windBtnContrl = {};

/**最小化***/
windBtnContrl.min = function()
{
	cmd.external(cmd.CMD_MIN);	
},

/**还原***/	
windBtnContrl.reduct = function()
{
	// alert();
	cmd.external(cmd.CMD_REDUCT);	
},

/**关闭***/	
windBtnContrl.close = function(type=1)
{
	if(type == 1) //type:1询问是否退出
	{
		lang.exit(callback,true);
	}
	else //直接退出
	{
		cmd.external(cmd.CMD_EXIT);
	}
	
	async function  callback(res)
	{
		if(res && res.confirm)
		{
			// cmd.external(cmd.CMD_EXIT);
			let goUrl = "../login/login";
			uni.navigateTo({
				url:goUrl
			})
		}
	}
}

/***移动窗口***/
windBtnContrl.mousedown = function()
{
	cmd.external(cmd.CMD_MOVE);
}

export default windBtnContrl;
